import api from "/api/api.js"




//添加帖子
export const apiAdd = (data) => {
  return api({
    url: '/forum/add',
    method: 'POST',
    data,
  })
}

//获取帖子列表
export const apiGetForumList = (data) => {
  return api({
    url: '/forum/getList',
    method: 'GET',
    data,
  })
}

//获取某个帖子的详情
export const apiGetForumDetails = (postId) => {
  return api({
    url: `/forum/details/${postId}`,
    method: 'GET',
  })
}


//获取某个帖子下的评论列表
export const apiGetCriticizeList = (data) => {
  return api({
    url: '/criticize/postCriticizeList',
    method: 'GET',
    data,
  })
}

//点赞或者取消点赞
export const apiDropLike = (data) => {
  return api({
    url: `/postLike/dropLike`,
    method: 'GET',
    data,
  })
}

//添加评论
export const apiAddCriticize = (data) => {
  return api({
    url: `/criticize/add`,
    method: 'POST',
    data,
  })
}

//获取用户的帖子列表
export const apiForumUserList = (data) => {
  return api({
    url: `/forum/userList`,
    method: 'GET',
    data,
  })
}

//删除帖子
export const apiDeletePost = (postId) => {
  return api({
    url: `/forum/delete/${postId}`,
    method: 'DELETE',
  })
}

//删除图片
export const deleteOssImage = (params) => {
  return api({
    url: '/common/deleteOss',
    method: 'POST',
    params,
  })
}
